This report aims to visualize oil spill incident data in California for the year 2008, as tracked by The Office of Spill Prevention and Response (OSPR). OSPR defines an “incident” in this case as “a discharge or threatened discharge of petroleum or other deleterious material into the waters of the state”(Lampinen, 2020). The report includes an interactive map with all spill events in California, and a choropleth map visualizing inland oil spill events by county.
knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE)
library(tidyverse)
library(here)
library(janitor)
library(sf)
library(tmap)
### read in the data
ca_counties_sf <- read_sf(here("data", "ca_counties", "CA_Counties_TIGER2016.shp")) %>%
clean_names() %>%
select(county_name = namelsad, land_area = aland)
oil_spills <- read_csv(here("data", "Oil_Spill_Incident_Tracking_[ds394].csv")) %>%
clean_names()
### CRS
#ca_counties_sf %>% st_crs() ### EPSG 3857, WGS 84
oil_spills_sf<- st_as_sf(oil_spills, coords=c("x","y"), crs = st_crs(ca_counties_sf))
# Set the viewing mode to "interactive":
tmap_mode(mode = "view")
# interactive map
tm_shape(ca_counties_sf) +
tm_polygons(alpha = 0) +
tm_shape(oil_spills_sf)+
tm_dots(col = "gold1")